package co.yixiang.yshop.module.distributor.controller.app.distributorproduct;

import co.yixiang.yshop.framework.common.pojo.CommonResult;
import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
import co.yixiang.yshop.module.distributor.controller.app.distributorproduct.vo.AppDistributorProductReqVO;
import co.yixiang.yshop.module.distributor.controller.app.distributorproduct.vo.AppDistributorProductRespVO;
import co.yixiang.yshop.module.distributor.service.distributor.DistributorFacade;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;

@Slf4j
@RestController
@Tag(name = "APP - 分销商商品模块")
@RequestMapping("/app/distributor/product")
public class AppDistributorProductController {

    @Resource
    private DistributorFacade distributorFacade;

    // 获取可分销商品列表
    @PreAuthenticated
    @GetMapping("/page")
    @Operation(summary = "分销商品分页")
    public CommonResult<PageResult<AppDistributorProductRespVO>> getProductPage(AppDistributorProductReqVO reqVO) {
        return success(distributorFacade.getProductPage(reqVO));
    }

}
